[IA64] split parts of page.h into maddr.h
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 23 Aug 2006 17:15:29 +0000 (11:15 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 23 Aug 2006 17:15:29 +0000 (11:15 -0600)
ia64 support for xen-unstable.hg cset 11081:9c953e1b6fad

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
linux-2.6-xen-sparse/include/asm-ia64/maddr.h [new file with mode: 0644]
linux-2.6-xen-sparse/include/asm-ia64/page.h

diff --git a/linux-2.6-xen-sparse/include/asm-ia64/maddr.h b/linux-2.6-xen-sparse/include/asm-ia64/maddr.h
new file mode 100644 (file)
index 0000000..dbff05b
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef _ASM_IA64_MADDR_H
+#define _ASM_IA64_MADDR_H
+
+#ifndef __ASSEMBLY__
+#ifdef CONFIG_XEN
+
+#define INVALID_P2M_ENTRY      (~0UL)
+
+#include <linux/kernel.h>
+#include <asm/hypervisor.h>
+#include <xen/features.h>      // to compile netback, netfront
+typedef unsigned long maddr_t; // to compile netback, netfront
+
+
+/* XXX xen page size != page size */
+
+static inline unsigned long
+pfn_to_mfn_for_dma(unsigned long pfn)
+{
+       unsigned long mfn;
+       mfn = HYPERVISOR_phystomach(pfn);
+       BUG_ON(mfn == 0); // XXX
+       BUG_ON(mfn == INVALID_P2M_ENTRY); // XXX
+       BUG_ON(mfn == INVALID_MFN);
+       return mfn;
+}
+
+static inline unsigned long
+phys_to_machine_for_dma(unsigned long phys)
+{
+       unsigned long machine =
+                     pfn_to_mfn_for_dma(phys >> PAGE_SHIFT) << PAGE_SHIFT;
+       machine |= (phys & ~PAGE_MASK);
+       return machine;
+}
+
+static inline unsigned long
+mfn_to_pfn_for_dma(unsigned long mfn)
+{
+       unsigned long pfn;
+       pfn = HYPERVISOR_machtophys(mfn);
+       BUG_ON(pfn == 0);
+       //BUG_ON(pfn == INVALID_M2P_ENTRY);
+       return pfn;
+}
+
+static inline unsigned long
+machine_to_phys_for_dma(unsigned long machine)
+{
+       unsigned long phys =
+                     mfn_to_pfn_for_dma(machine >> PAGE_SHIFT) << PAGE_SHIFT;
+       phys |= (machine & ~PAGE_MASK);
+       return phys;
+}
+
+#define set_phys_to_machine(pfn, mfn) do { } while (0)
+#define xen_machphys_update(mfn, pfn) do { } while (0)
+
+/* XXX to compile set_phys_to_machine(vaddr, FOREIGN_FRAME(m)) */
+#define FOREIGN_FRAME(m)        (INVALID_P2M_ENTRY)
+
+#define mfn_to_pfn(mfn)                        (mfn)
+#define mfn_to_virt(mfn)               (__va((mfn) << PAGE_SHIFT))
+#define pfn_to_mfn(pfn)                        (pfn)
+#define virt_to_mfn(virt)              (__pa(virt) >> PAGE_SHIFT)
+#define virt_to_machine(virt)          __pa(virt) // for tpmfront.c
+
+static inline unsigned long
+mfn_to_local_pfn(unsigned long mfn)
+{
+       extern unsigned long max_mapnr;
+       unsigned long pfn = mfn_to_pfn_for_dma(mfn);
+       if (!pfn_valid(pfn))
+               return INVALID_P2M_ENTRY;
+       return pfn;
+}
+
+#endif /* CONFIG_XEN */
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_IA64_MADDR_H */
index 67312ea310c4ac5d74431b032eb664492293e42b..fca73f00ef9261f6481bb68a8763b8d167ca2428 100644 (file)
@@ -224,12 +224,9 @@ get_order (unsigned long size)
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_XEN
 
-#define INVALID_P2M_ENTRY      (~0UL)
-
 #include <linux/kernel.h>
 #include <asm/hypervisor.h>
 #include <xen/features.h>      // to compile netback, netfront
-typedef unsigned long maddr_t; // to compile netback, netfront
 
 /*
  * XXX hack!
@@ -268,68 +265,7 @@ extern struct address_space xen_ia64_foreign_dummy_mapping;
 })
 #define HAVE_ARCH_FREE_PAGE
 
-/* XXX xen page size != page size */
-
-static inline unsigned long
-pfn_to_mfn_for_dma(unsigned long pfn)
-{
-       unsigned long mfn;
-       mfn = HYPERVISOR_phystomach(pfn);
-       BUG_ON(mfn == 0); // XXX
-       BUG_ON(mfn == INVALID_P2M_ENTRY); // XXX
-       BUG_ON(mfn == INVALID_MFN);
-       return mfn;
-}
-
-static inline unsigned long
-phys_to_machine_for_dma(unsigned long phys)
-{
-       unsigned long machine =
-                     pfn_to_mfn_for_dma(phys >> PAGE_SHIFT) << PAGE_SHIFT;
-       machine |= (phys & ~PAGE_MASK);
-       return machine;
-}
-
-static inline unsigned long
-mfn_to_pfn_for_dma(unsigned long mfn)
-{
-       unsigned long pfn;
-       pfn = HYPERVISOR_machtophys(mfn);
-       BUG_ON(pfn == 0);
-       //BUG_ON(pfn == INVALID_M2P_ENTRY);
-       return pfn;
-}
-
-static inline unsigned long
-machine_to_phys_for_dma(unsigned long machine)
-{
-       unsigned long phys =
-                     mfn_to_pfn_for_dma(machine >> PAGE_SHIFT) << PAGE_SHIFT;
-       phys |= (machine & ~PAGE_MASK);
-       return phys;
-}
-
-#define set_phys_to_machine(pfn, mfn) do { } while (0)
-#define xen_machphys_update(mfn, pfn) do { } while (0)
-
-/* XXX to compile set_phys_to_machine(vaddr, FOREIGN_FRAME(m)) */
-#define FOREIGN_FRAME(m)        (INVALID_P2M_ENTRY)
-
-#define mfn_to_pfn(mfn)                        (mfn)
-#define mfn_to_virt(mfn)               (__va((mfn) << PAGE_SHIFT))
-#define pfn_to_mfn(pfn)                        (pfn)
-#define virt_to_mfn(virt)              (__pa(virt) >> PAGE_SHIFT)
-#define virt_to_machine(virt)          __pa(virt) // for tpmfront.c
-
-static inline unsigned long
-mfn_to_local_pfn(unsigned long mfn)
-{
-       extern unsigned long max_mapnr;
-       unsigned long pfn = mfn_to_pfn_for_dma(mfn);
-       if (!pfn_valid(pfn))
-               return INVALID_P2M_ENTRY;
-       return pfn;
-}
+#include <asm/maddr.h>
 
 #endif /* CONFIG_XEN */
 #endif /* __ASSEMBLY__ */